#include "Shooter_PCH.h"
#include "TexManager.h"

/*--------------------------------------------------------------------------*/

TexManager::TexManager()
{

}

/*--------------------------------------------------------------------------*/

TexManager::~TexManager()
{

}

/*--------------------------------------------------------------------------*/

void TexManager::Load( const std::string& name )
{
	Texture* texture = new Texture(name, "../data/img/" + name);
	Register(name, texture);
}

/*--------------------------------------------------------------------------*/

void TexManager::Unload( const std::string& name )
{
	Texture* texture = Get(name);

	if (texture)
	{
		delete texture;
	}
}

/*--------------------------------------------------------------------------*/

void TexManager::Bind( const std::string& name, unsigned int channel )
{
	Texture* texture = Get(name);

	if (texture)
	{
		glActiveTexture(GL_TEXTURE0 + channel);
		glBindTexture(GL_TEXTURE_2D, texture->GetHandle());
	}
}

/*--------------------------------------------------------------------------*/